<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('base/common-header', TEMPLATE_INCLUDEPATH)) : (include template('base/common-header', TEMPLATE_INCLUDEPATH));?>
<style type="text/css">
    td.div {
        margin: 6px auto 6px;
    }
</style>



<div class="btn-group" role="group" aria-label="...">

    <a href="<?php  echo aurl('addmch')?>" class="btn btn-success">新增</a>

    <!-- <a href="javascript:;" class="btn btn-primary check-all-control">全选</a> -->

    <!-- <a href="<?php  echo aurl('remove')?>" class="btn btn-danger ajax-post confirm" data-form="#form" data-confirm="确定要删除勾选项吗?">删除</a> -->

</div>

<!-- 搜索 -->

<form action="<?php  echo aurl('index')?>" method="GET" id="form_search" class="table-top-search form-inline" style="float: right;padding-bottom: 15px">
    <input type="text" name="mch_name" class="form-control" placeholder="搜索姓名" value="<?php  echo $_GET['mch_name'];?>">

    <input type="text" name="active_name" class="form-control" placeholder="搜索活动名称" value="<?php  echo $_GET['active_name'];?>">
    <select name="mch_status">
        <option value=" " <?php  if($_GET['mch_status'] =='') { ?>selected="selected" <?php  } ?>>
            请选择
        </option>
        <option value="on" <?php  if($_GET['mch_status'] =='on') { ?>selected="selected" <?php  } ?>>
            正常
        </option>
        <option value="off" <?php  if($_GET['mch_status'] =='off') { ?>selected="selected" <?php  } ?>>
            关闭
        </option>
        <option value="check" <?php  if($_GET['mch_status'] =='check') { ?>selected="selected" <?php  } ?>>
            打回信息&nbsp;
        </option>
    </select>
    <button class="btn btn-warning">搜索</button>

</form>



<form action="javascript:void(0)" method="POST" id="form">

    <table class="table table-hover">

        <thead>

            <tr>

                <th>编号</th>

                <th width="20%">商家</th>

                <th width="25%">加盟信息</th>
                <th width="10%">主核销员</th>

                <th>记录</th>

                

                <th>卡券信息</th>

                <th>操作</th>

            </tr>

        </thead>

        <tbody>

            <?php  if(is_array($list)) { foreach($list as $item) { ?>

            <tr>

                <td><?php  echo $item['uni_id'];?></td>

                <td>

                    <div>

                        <?php  echo $_W['NS']['mch_status_label'][$item['status']];?>&nbsp;姓名：<?php  echo $item['name'];?>

                    </div>

                    <div>

                        商家名称：<?php  echo $item['mch_name'];?>

                       

                    </div>
                    <div>
                        手机号：<?php  echo $item['mobile'];?>
                    </div>
                    <div>

                        地址：<?php  echo $item['address'];?>

                    </div>
                    
                </td>

                <td>
                    <div>
                        行业：<?php  echo $item['industry_name'];?>
                    </div>
                    <div>
                        加盟时间：<?php  echo date('Y-m-d H:i:s', $item['create_time'])?>
                    </div>
                    <div>
                        活动：<?php  echo $item['active_name'];?>
                    </div>
                    <div>手机修改信息链接：<a href="javascript:;" class="cliplink" data-text="<?php  echo web2app_url('Main', ['et' => 'newjoin', 'mch_id' => $item['id'], 'pid' => $item['active_id']])?>"><i
                        class="fa fa-link"></i> 复制链接</a></div>
                </td>

                <td>

                   <div>
                    <img src="<?php  echo userinfo($item['openid'])['avatar']?>" style="border-radius:50%;" width="24px">&ensp;
                    <?php  echo userinfo($item['openid'])['nickname']?>
                    </div>
                        <div>
                            <a href="<?php  echo aurl('bindMch',['mch_id'=>$item['id']])?>" class="a a-hover label label-success">修改</a>
                        </div>
                    <!-- <div>

                        微信充值：<span class="label label-success">+ <?php  echo $item['charge_wx']['sum_price'];?></span>&nbsp;元
                    </div>
                    <div>

                        红包支出：<span class="label label-danger">- <?php  echo $item['spend_red']['sum_price'];?></span>&nbsp;元
                    </div> -->
                </td>
                <td>
                    <div>

                        
                        <div>

                            余额：<span class="label label-primary"><?php  echo $item['balance'];?></span>&nbsp;元
    
                        </div>

                    </div>

                    
                </td>

                <td>
                    <div>
                        领取人数：<span class="label label-primary"><?php  echo $item['tickets'];?></span>&nbsp;人
                       
                       
                    </div>
                    <div> 
                        核销次数：<span class="label label-primary"><?php  echo $item['cav_times'];?></span>&nbsp;次
                    </div>
                </td>

                <td>

                    <div>

                        <label class="dropdown label" style="vertical-align: -1px;padding-left:0;padding-right:0">
                            <a id="dLabel" data-target="#" href="javascript:;" class="label label-success" data-toggle="dropdown"
                                role="button" aria-haspopup="true" aria-expanded="false">编辑<span class="caret"></span></a>
                            <ul class="dropdown-menu" aria-labelledby="dLabel">
                                <li><a href="<?php  echo aurl('addmch',['mchid'=>$item['id']])?>"><i class="fa fa-edit"></i>
                                        编辑此商家</a></li>
                                <li><a href="<?php  echo aurl('addmch',['mchid_copy'=>$item['id']])?>"><i class="fa fa-copy"></i>
                                        创建此商家的副本</a></li>
                            </ul>
                        </label>

                        <?php  if($item['status'] == 'off') { ?>

                        <a href="<?php  echo aurl('normal',['mchid'=>$item['id']])?>" class="a a-hover label label-info ajax-post confirm"
                            data-mchid="<?php  echo $item['id'];?>">正常</a>

                        <?php  } else { ?>

                        <a href="<?php  echo aurl('close',['mchid'=>$item['id']])?>" class="a a-hover label label-danger ajax-post confirm"
                            data-mchid="<?php  echo $item['id'];?>">关闭</a>

                        <?php  } ?>

                    </div>

                    <div>

                        <a href="<?php  echo aurl('showBind',['active_id'=>$item['active_id'],'mch_id'=>$item['id']])?>"
                            class="a a-hover label label-info">查看绑定核销员</a>

                    </div>

                    <div>

                        <a href="<?php  echo aurl('showBill',['active_id'=>$item['active_id'],'mch_id'=>$item['id']])?>"
                            class="a a-hover label label-warning">查看账单</a>

                        <a href="<?php  echo aurl('showBalance',['active_id'=>$item['active_id'],'mch_id'=>$item['id']])?>"
                            class="a a-hover label label-success">修改余额</a>

                    </div>

                    <div>



                    </div>

                </td>

            </tr>

            <?php  } } ?>

        </tbody>

    </table>

    <?php  echo $page;?>

</form>

<script>
        requirejs.config({
            appDir: '.',
            paths: {
                'clipboard': ['<?php echo WEB_RESOURCE;?>/lib/clipboard.min']
            }
        });
        require(['jquery', 'clipboard'], function ($, Clipboard) {
    
            var clipboard = new Clipboard('.cliplink', {
                text: function (e) {
                    return $(e).attr('data-text');
                }
            });
    
            clipboard.on('success', function (e) {
                xalert('复制成功', true, true);
            });
            clipboard.on('error', function () {
                xalert('复制失败', false, true);
            });
        });
    
    </script>

<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('base/common-footer', TEMPLATE_INCLUDEPATH)) : (include template('base/common-footer', TEMPLATE_INCLUDEPATH));?><script>var we7CommonForModule = document.createElement("script");we7CommonForModule.src = '//cdn.w7.cc/we7/w7windowside.js?v=201904260003';document.body.appendChild(we7CommonForModule)
</script>